package com.uhaou.common.util;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import cn.org.rapid_framework.util.holder.ApplicationContextHolder;

public class InitApplicationContextServlet  extends HttpServlet{

	/**
	 * 自动生成序列号
	 */
	private static final long serialVersionUID = -911553579769372190L;

	/**
	 * 初始化ApplicationContextHolder里的context，避免加载两次
	 */
	public void init() throws ServletException {
		super.init();
		/*ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(this.getServletContext());
		*/// 初始化applicationContextHolder的spring context
		ApplicationContext ctx = WebApplicationContextUtils
		.getRequiredWebApplicationContext(this.getServletContext());
	    System.out.print("nidaye");
	    StaticMap.initInfor(ctx);
	    System.out.print("nidayeend");
		// 初始化内存中工单数组 ,add by qinmin
		// SheetKeyInit.init();
		// try{
		// ITawCommonsJobmonitorManager tawCommonsJobmonitorManager =
		// (ITawCommonsJobmonitorManager)ApplicationContextHolder.getInstance().getBean("ItawCommonsJobmonitorManager");
		// tawCommonsJobmonitorManager.instance();
		// tawCommonsJobmonitorManager.run();
		// }catch(Exception e){
		// BocoLog.error(e,"初始化轮循程序失败！");
		// e.printStackTrace();
		// }
	}
}
